'use strict';

module.exports = () => {
    /**
     * built-in config
     * @type {Egg.EggAppConfig}
     **/
    const config = exports = {};

    // sequelize连接配置
    config.sequelize = {
        dialect: 'mysql',
        host: process.env.CI_DB_HOST,
        port: process.env.CI_DB_PORT,
        database: process.env.CI_DB_DATABASE,
        username: process.env.CI_DB_USERNAME,
        password: process.env.CI_DB_PASSWORD,
        pool: {
            max: 5,
            min: 0,
        },
        define: {
            timestamps: false, // 时间戳配置
            paranoid: false, // 软删除配置
            freezeTableName: true, // 冻结表名
            underscored: true,
            createdAt: 'created_at', // 自定义时间戳
            updatedAt: 'updated_at', // 自定义时间戳
            deletedAt: 'deleted_at', // 自定义时间戳
        },
        timezone: '+08:00',
    };

    return {
        ...config,
    };
};
